package by.grsu.coctails.model;

import android.os.Parcel;
import android.os.Parcelable;

public class Ingredient implements Parcelable {

	public static final Parcelable.Creator<Ingredient> CREATOR = new Creator<Ingredient>() {

		public Ingredient[] newArray(int size) {
			return new Ingredient[size];
		}

		public Ingredient createFromParcel(Parcel in) {
			return new Ingredient(in);
		}
	};

	private String name;

	private String image;

	private String categoryName;

	private String categoryImage;

	private String count;

	private String amountValue;

	private Integer isHaved;

	public Ingredient(String name, String image, String categoryName,
			String categoryImage, Integer isHaved) {
		this(name, image, categoryName, categoryImage, null, null, isHaved);
	}

	public Ingredient(String name, String image, String categoryName,
			String categoryImage, String count, String amountValue,
			Integer isHaved) {
		this.name = name;
		this.image = image;
		this.categoryName = categoryName;
		this.categoryImage = categoryImage;
		this.count = count;
		this.amountValue = amountValue;
		if (isHaved != null) {
			this.isHaved = isHaved;
		} else {
			this.isHaved = 0;
		}
	}

	public Ingredient(Parcel in) {
		readFromParcel(in);
	}

	public Ingredient() {

	}

	public String getName() {
		return name;
	}

	public String getImage() {
		return image;
	}

	public String getCategoryName() {
		return categoryName;
	}

	public String getCategoryImage() {
		return categoryImage;
	}

	public String getCount() {
		return count;
	}

	public String getAmountValue() {
		return amountValue;
	}

	@Override
	public int describeContents() {
		return 0;
	}

	public Integer isHaved() {
		return isHaved;
	}

	public void setHaved(Integer isHaved) {
		this.isHaved = isHaved;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeString(name);
		dest.writeString(image);
		dest.writeString(categoryName);
		dest.writeString(categoryImage);
		dest.writeString(count);
		dest.writeString(amountValue);
		dest.writeInt(isHaved);
	}

	public void readFromParcel(Parcel in) {
		this.name = in.readString();
		this.image = in.readString();
		this.categoryName = in.readString();
		this.categoryImage = in.readString();
		this.count = in.readString();
		this.amountValue = in.readString();
		this.isHaved = in.readInt();
	}

}
